<template>
	<view v-if="pageShow">
		<image :src="acticateimg" mode="" style="height: 100vh;width: 100vw;" @click="tzgg"></image>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				acticateimg: "",
				url2: "",
				flag: true,
				pageShow:false,
			}
		},
		onShow() {
			this.flag = true
			this.getpage()
		},
		methods: {
			getpage() {
				httpRequest.request('/api/index/getConfigInfo', 'GET', {}).then(res => {
					this.acticateimg = res.data.kp_image
					this.url2 = res.data.kp_url
					if(res.data.kp_url){
						this.pageShow = true
						let num = 0
						let setinte = setInterval(() => {
							if (this.flag) {
								num = num + 1
							} else {
								clearInterval(setinte)
								return
							}
							if (num == 2) {
								clearInterval(setinte)
								uni.reLaunch({
									url: "/pages/homepage"
								})
							}
						}, 1000)
					}else{
						uni.reLaunch({
							url: "/pages/homepage"
						})
					}
				})
			},
			tzgg() {
				this.flag = false
				if(this.url2.includes("http")){
					let data = {
						url2: this.url2
					}
					uni.redirectTo({
						url: "/pages/webview?msg=" + encodeURIComponent(JSON.stringify(data))
					})
				}else{
					uni.redirectTo({
						url: this.url2
					})
				}
			}
		}
	}
</script>

<style>

</style>